package com.nativetalk.dao;

import com.nativetalk.base.Page;
import com.nativetalk.bean.TdNtTeaInvitation;
import com.nativetalk.bean.TdNtTeacher;
import com.nativetalk.bean.TsNtCourseInfo;
import com.nativetalk.bean.category.TsNtCategoryTeacher;
import com.nativetalk.bean.comment.TdNtCommentCouse;
import com.nativetalk.bean.course.TdNtCoursePictureListUrl;
import com.nativetalk.bean.course.TsNtCourseInfoIndex;
import com.nativetalk.bean.course.TsNtCourseInfoIndexTwo;
import com.nativetalk.bean.demand.TdNtDemand;
import com.nativetalk.bean.dict.TeacherLanguage;
import com.nativetalk.bean.member.TdNtMemberFuns;
import com.nativetalk.bean.member.TdNtMemberGetui;
import com.nativetalk.bean.rongyun.UserCommit;
import com.nativetalk.bean.teacher.*;
import com.nativetalk.dto.TeacherRecommendResponse;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * Created by lizhun on 16/1/7.
 * Modified by wangzheng on 17/02/21
 */
@MyBatisRepository
public interface TdNtTeacherDao {

    public TdNtTeacherResult findTeacherByTeaId(int tea_id);
    /**
     * @Purpose  根据邮箱查找教师存在与否
     * @version  1.0
     * @author   lizhun
     * @param    tea_email
     * @return   TdNtTeacherResult
     */
    public TdNtTeacherResult findTdNtTeacherResult(String tea_email);
    /**
     * @Purpose  根据邀请码查找教师存在与否
     * @version  1.0
     * @author   lizhun
     * @param    tea_invite_code
     * @return   TdNtTeacherResult
     */
    public TdNtTeacherResult findTdNtTeacherResultByCode(String tea_invite_code);
    /**
     * @Purpose  添加教师信息
     * @version  1.0
     * @author   lizhun
     * @param    tdNtTeacherRegister
     * @return   void
     */
    @Options(useGeneratedKeys = true, keyProperty = "tea_id")
    public void insertTdNtTeacher(TdNtTeacherRegister tdNtTeacherRegister);
    /**
     * @Purpose  更新教师余额
     * @version  1.0
     * @author   lizhun
     * @param    tdNtTeacherUpdate
     * @return   void
     */
    public void updateTdNtTeacherBalance(TdNtTeacherUpdate tdNtTeacherUpdate);
    /**
     * @Purpose  更新教师密码及token
     * @version  1.0
     * @author   lizhun
     * @param    tdNtTeacherResult
     * @return   void
     */
    public void updateTdNtTeacherPsdAndToken(TdNtTeacherResult tdNtTeacherResult);
    /**
     * @Purpose  更新教师信息
     * @version  1.0
     * @author   lizhun
     * @param    tdNtTeacherResult
     * @return   void
     */
    public void updateTdNtTeacher(TdNtTeacherResult tdNtTeacherResult);
    /**
     * @Purpose  查找教师余额
     * @version  1.0
     * @author   lizhun
     * @param    tea_id
     * @return   BigDecimal
     */
    public BigDecimal findTdNtTeacherBalance(Integer tea_id);
    /**
     * @Purpose  查找教师首页数据
     * @version  1.0
     * @author   lizhun
     * @param    tea_id
     * @return   TdNtTeacherIndex
     */
    public TdNtTeacherIndex findTdNtTeacherIndex(Integer tea_id);
    /**
     * @Purpose  更新用户教学开关
     * @version  1.0
     * @author   lizhun
     * @param    tdNtTeacherState
     * @return   void
     */
    public void updateTdNtTeacherState(TdNtTeacherState tdNtTeacherState);
    /**
     * @Purpose  根据课程id查找所有可接单的教师
     * @version  1.0
     * @author   lizhun
     * @param    map
     * @return   void
     */
    public List<TdNtTeacherGetui> findTdNtTeacherByCouId(Map<String,Object> map);
    /**
     * @Purpose  根据课程id随机查找所有可接单的教师
     * @version  1.0
     * @author   lizhun
     * @param    map
     * @return   void
     */
    public List<TdNtTeacherGetui> findTdNtTeacherByCouIdRound(Map<String,Object> map);
    /**
     * @Purpose  更新教师余额及教学时长
     * @version  1.0
     * @author   lizhun
     * @param    tdNtTeacherIndex
     * @return   void
     */
    public void updateTdNtTeacherIndex(TdNtTeacherIndex tdNtTeacherIndex);

    /**
     * @Purpose  更新教师认证
     * @version  1.0
     * @author   lizhun
     * @param    map
     * @return   void
     */
    public void updateTdNtTeacherApply(Map<String,Object> map);
    /**
     * @Purpose  查找教师用户名,简介,学校id
     * @version  1.0
     * @author   lizhun
     * @param    tea_id
     * @return   TdNtTeacherIndex
     */
    public TdNtTeacher findTdNtTeacherOn(Integer tea_id);
    /**
     * @Purpose  删除教师邮箱
     * @version  1.0
     * @author   wuyuanhui
     * @param    tdNtTeacherResult
     * @return
     */
    public void deleteTdNtTeacherEmail(TdNtTeacherResult tdNtTeacherResult);
    /**
     * @Purpose  修改教师认证头像
     * @version  1.0
     * @author   wuyuanhui
     * @param    tdNtTeacherPortrait
     * @return
     */
    public void updateTdNtTeacherProtrait(TdNtTeacherPortrait tdNtTeacherPortrait);
    /**
     * @Purpose  修改教师认证语音简介
     * @version  1.0
     * @author   wuyuanhui
     * @param    tdNtTeacherSound
     * @return
     */
    public void updateTdNtTeacherSound(TdNtTeacherSound tdNtTeacherSound);
    /**
     * @Purpose  根据cou_id查找教师信息数量
     * @version  1.0
     * @author   lizhun
     * @param    page
     * @return   List<TdNtTeacherCourse>
     */
    public int findTdNtTeacherCouIdSize(com.nativetalk.base.Page page);

    /**
     * @Purpose  根据cou_id查找教师信息
     * @version  1.0
     * @author   lizhun
     * @param    page
     * @return   List<TdNtTeacherCourse>
     */
    public List<TdNtTeacherCourse> findTdNtTeacherCouIdPage(com.nativetalk.base.Page page);
    /**
     * @Purpose  根据cou_id查找教师信息
     * @version  1.0
     * @author   lizhun
     * @param    page
     * @return   List<TdNtTeacherCourse>
     */
    public List<TdNtTeacherCollection> findTdNtTeacherCouIdPageThree(com.nativetalk.base.Page page);
    /**
     * @Purpose  根据教师查找邀请的人数
     * @version  1.0
     * @author   wuyuanhui
     * @param    tea_id
     * @return   int
     */
    public int findInviteSize(Integer tea_id);
    /**
     * @Purpose  添加邀请记录
     * @version  1.0
     * @author   wuyuanhui
     * @param    tdNtTeaInvitation
     */
    public void insertInvit(TdNtTeaInvitation tdNtTeaInvitation);
    /**
     * @Purpose  根据教师id查找老师
     * @version  2.0
     * @author   lizhun
     * @param    tea_id
     * @return   void
     */
    public TdNtTeacherGetui findTdNtTeacherByTeaId(Integer tea_id);
    /**
     * @Purpose  根据教师id查找教师数据
     * @version  2.0
     * @author   lizhun
     * @param    tea_id
     * @return   TdNtTeacherCourse
     */
    public TdNtTeacherCourse findTeacherStudy(Integer tea_id);
    /**
     * @Purpose  查找教师首页数据添加学习记录用
     * @version  1.0
     * @author   lizhun
     * @param    tea_id
     * @return   TdNtTeacherStudyInsert
     */
    public TdNtTeacherStudyInsert findTdNtTeacherStudyInsert(Integer tea_id);
    /**
     * @Purpose  修改教师收藏/未收藏
     * @version  1.0
     * @author   wuyuanhui
     * @param    obj
     */
    public void updateTeacherCollect(Map<String, Object> obj);
    /**
     * @Purpose  修改是否上线提醒
     * @version  1.0
     * @author   wuyuanhui
     * @param    obj
     */
    public void updateTeacherOnline(Map<String, Object> obj);
    /**
     * @Purpose  查找用户是否收藏教师
     * @version  1.0
     * @author   wuyuanhui
     * @param    obj
     * @return   String
     */
    public String foundTdNtTeacherCollection(Map<String, Object> obj);
    /**
     * @Purpose  查找教师信息数量
     * @version  1.0
     * @author   wuyuanhui
     * @return   List<TdNtTeacherCourse>
     */
    public int findTdNtTeacherSize(Page page);
    /**
     * @Purpose  查找列表教师信息
     * @version  1.0
     * @author   wuyuanhui
     * @param    page
     * @return   List<TdNtTeacherCourse>
     */
    public List<TdNtTeacherCollection> findTdNtTeacherPage(Page page);

    /**
     * @Purpose  查找教师开启的课程名称
     * @version  1.0
     * @author   wuyuanhui
     * @param    tea_id
     * @return   List<TsNtCourseInfoIndex>
     */
    public List<TsNtCourseInfo> findTeacherOpenCourseInfo(Integer tea_id);
    /**
     * @Purpose  查找教师开启的课程名称
     * @version  1.0
     * @author   wuyuanhui
     * @param    cou_id
     * @return   List<TsNtCourseInfoIndex>
     */
    public List<TsNtCourseInfoIndex> findTdNtTeacherCourse(Integer cou_id);
    /**
     * @Purpose  获取课程的banner的信息
     * @version  1.0
     * @author   wuyuanhui
     * @param    cou_id
     * @return   List<TdNtCoursePictureListUrl>
     */
    public List<TdNtCoursePictureListUrl> findCourseBannerImg(Integer cou_id);
    /**
     * @Purpose  获取课程的评论的信息
     * @version  1.0
     * @author   wuyuanhui
     * @param    tea_id
     * @return   List<TdNtCoursePictureListUrl>
     */
    public List<TdNtCommentCouse> findTdNtTeacherComments(Integer tea_id);
    /**
     * @Purpose  获取老师的粉丝数量
     * @version  1.0
     * @author   wuyuanhui
     * @param    tea_id
     * @return   int
     */
    public int findFunsSize(Integer tea_id);
    /**
     * @Purpose  获取课程的评论的信息数量
     * @version  1.0
     * @author   wuyuanhui
     * @return   List<TdNtCoursePictureListUrl>
     * @param tea_id
     */
    public int findTdNtTeacherCommentsSize(Integer tea_id);
    /**
     * @Purpose  获取课程的评论的信息
     * @version  1.0
     * @author   wuyuanhui
     * @return   List<TdNtCoursePictureListUrl>
     */
    public List<TdNtCommentCouse> findTdNtTeacherCommentsPage(Integer tea_id);
    /**
     * @Purpose  获取课程的评论的信息
     * @version  1.0
     * @author   wuyuanhui
     * @return   List<TdNtCoursePictureListUrl>
     */
    public List<TdNtCommentCouse> findTdNtTeacherCommentsPage(Page page);

    /**
     * @Purpose  粉丝列表
     * @version  1.0
     * @author   wuyuanhui
     * @return   List<TdNtMemberFuns>
     */
    public List<TdNtMemberFuns> findfunslistPage(Page page);
    /**
     * @Purpose  关注列表数量
     * @version  1.0
     * @author   wuyuanhui
     * @return   int
     */
    public int findAttentionlistSize(Integer memb_id);
    /**
     * @Purpose  关注列表信息
     * @version  1.0
     * @author   wuyuanhui
     * @return   int
     */
    public List<TdNtTeacherCollectionOnline> findAttentionlistPage(Page page);
    /**
     * @Purpose  根据tea_id查找关注的学生
     * @version  1.0
     * @author   wuyuanhui
     * @return   int
     */
    public List<TdNtMemberGetui> findTdNtMemberByTeaID(int tea_id);
    /**
     * @Purpose  查找信息是否存在
     * @version  1.0
     * @author   wuyuanhui
     * @return   int
     */
    public int findCollection(Map<String, Object> obj);
    /**
     * @Purpose  插入信息
     * @version  1.0
     * @author   wuyuanhui
     * @return   int
     */
    public void insertTeacherCollect(Map<String, Object> obj);
    /**
     * @Purpose  插入信息
     * @version  1.0
     * @author   wuyuanhui
     * @return   int
     */
    public void insertTeacherOnline(Map<String, Object> obj);
    /**
     * @Purpose  查找教师上线提醒
     * @version  1.0
     * @author   wuyuanhui
     * @param    obj
     * @return   List<TdNtTeacherCourse>
     */
    public String foundTdNtTeacherOnline(Map<String, Object> obj);
    /**
     * @Purpose  随机查找5位老师
     * @version  2.1
     * @author   lizhun
     * @return   List<TdNtTeacherRound>
     */
    public List<TdNtTeacherRound> findTdNtTeacherRound();

    /**
     * @Purpose  随机查找6位老师
     * @version  3.0
     * @author   lizhun
     * @return   List<TdNtTeacherRoundRegister>
     */
    public List<TdNtTeacherRoundRegister> findTdNtTeacherRoundRegister();

    public List<TdNtTeacherRoundRegister> findTdNtRecommendTeacherWithDemand(@Param("demands") List<TdNtDemand> demands);

    /**
     * @Purpose  修改教师教学价格
     * @version  3.0
     * @author   lizhun
     * @param    tdNtTeacherMinAmount
     * @return   void
     */
    public void updateTdNtTeacherMinAmount(TdNtTeacherMinAmount tdNtTeacherMinAmount);
    /**
     * @Purpose  修改支付方式
     * @version  3.0
     * @author   lizhun
     * @param    tdNtTeacherResult
     * @return   void
     */
    public void updateTeacherPay(TdNtTeacherResult tdNtTeacherResult);
    /**
     * @Purpose  查找教师每分钟价格
     * @version  3.1
     * @author   lizhun
     * @param    tea_id
     * @return   BigDecimal
     */
    public BigDecimal findTdNtTeacherMiuAmount(Integer tea_id);
    /**
     * @Purpose  根据教师id查找老师
     * @version  2.0
     * @author   lizhun
     * @param    tea_id
     * @return   void
     */
    public TdNtTeacherGetui findTdNtTeacher(Integer tea_id);
    /**
     * @Purpose  随机查找8位老师
     * @version  3.2
     * @author   lizhun
     * @return   List<TdNtTeacherIndexRound>
     */
    public List<TdNtTeacherIndexRound> findTdNtTdNtTeacherIndexRound();
    /**
     * @Purpose  分页查找老师信息
     * @version  3.2
     * @author   lizhun
     * @return   List<TdNtTeacherList>
     */
    public List<TdNtTeacherList> findTdNtTeacherList(Page page);
    /**
     * @Purpose  分页查找老师信息
     * @version  3.2
     * @author   lizhun
     * @return   int
     */

    public int findTdNtTeacherListSize(Page page);
    /**
     * @Purpose  根据教师id查找老师信息
     * @version  3.2
     * @author   lizhun
     * @param    tea_id
     * @return   TdNtTeacherParticulars
     */
    public TdNtTeacherParticulars findTdNtTeacherParticulars(Integer tea_id);
    /**
     * @Purpose  搜索老师数量
     * @version  3.2
     * @author   lizhun
     * @return   int
     */

    public int searchTdNtTeacherListSize(Page page);
    /**
     * @Purpose  分页搜索老师
     * @version  3.2
     * @author   lizhun
     * @return   List<TdNtTeacherList>
     */
    public List<TdNtTeacherList> searchTdNtTeacherList(Page page);
    /**
     * @Purpose  随机查找英国或美国老师
     * @version  3.2
     * @author   lizhun
     * @return   List<TdNtTeacherRoundRegister>
     */
    public List<TdNtTeacherRoundRegister> findTdNtTdNtTeacherNationalityRound(Map<String,Object> map);
    /**
     * @Purpose  查找教师领取奖励总额
     * @version  3.2
     * @author   lizhun
     * @param    tea_id
     * @return   BigDecimal
     */
    public BigDecimal findTeacherTotalReward(int tea_id);
    /**
     * @Purpose  更新教师领取奖励总额
     * @version  3.0
     * @author   lizhun
     * @param    map
     * @return   void
     */
    public void updateTeacherTotalReward(Map<String,Object> map);
    /**
     * @Purpose  根据课程类别搜索老师
     * @version  4.0
     * @author   lizhun
     * @return   int
     */
    public int findTeacherByCateSize(Page page);
    /**
     * @Purpose  分页根据课程类别搜索老师
     * @version  4.0
     * @author   lizhun
     * @return   List<TdNtTeacherListCourse>
     */
    public List<TdNtTeacherListCourse> findTeacherByCatePage(Page page);
    /**
     * @Purpose  查找老师相关推送信息
     * @version  4.0
     * @author   lizhun
     * @param    tea_id
     * @return   TdNtTeacherTuisong
     */
    public TdNtTeacherTuisong findTdNtTeacherTuisong(int tea_id);

    /**
     * @Purpose  根据课程搜索老师
     * @version  4.1
     * @author   wangzheng
     * @return   int
     */
    public int findTeacherByCourseSize(Page page);

    /**
     * @Purpose  分页根据课程搜索老师
     * @version  4.1
     * @author   wangzheng
     * @return   List<TdNtTeacherListCourse>
     */
    public List<TdNtTeacherListCourse> findTeacherByCoursePage(Page page);


    /**
     * 更新deviceId
     *
     * @param tea_id
     * @param equ_client_id
     */
    public void updateEquClientIdByTeaId(@Param("tea_id") int tea_id, @Param("equ_client_id") String equ_client_id,
                                         @Param("equ_type") String equ_type);

    /**
     * @Purpose  根据token查找老师信息
     * @version  4.1
     * @author   wangzheng
     * @return   TdNtTeacherResult
     */
    public TdNtTeacherResult findTdNtTeacherByToken(String token);

    /**
     * @Purpose  修改联系方式
     * @version  4.2
     * @author   wangzheng
     * @param    tdNtTeacherResult
     * @return   void
     */
    public void updateTeacherContact(TdNtTeacherResult tdNtTeacherResult);

    List<TeacherLanguage> findTeacherLanguages(String language);

    public void updateTeacherBalance(TdNtTeacherIndex tdNtTeacherIndex);

    void updateTeacherJustTalkUserUri(@Param("tea_id") Integer tea_id, @Param("justtalkUserUri") String justTalkUserUri);

    List<TeacherRecommendResponse> findHotTeachers();

    List<TsNtCategoryTeacher> findOpenCourseInfosByCategoryId(@Param("tea_id") Integer tea_id, @Param("categoryId") Integer categoryId);

    List<TsNtCourseInfoIndexTwo> findAllOpenCourse(int tea_id);

    TdNtTeacher findTeacherById(@Param("tea_id") Integer tea_id);

    public List<UserCommit> selectTeachersRongCloud();

    public UserCommit selectTeacherMessageById(@Param("tea_id")Integer tea_id);

    public void updateTeachersRongCloudToken(@Param("rongcloud_token")String rongcloud_token,@Param("tea_id")Integer tea_id);

    Integer findIsShowOpenClassTip(@Param("tea_id")Integer tea_id);

    String findOpenClasTip();

    void closeOpenClassTip(@Param("tea_id")Integer tea_id);
}
